#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
const ll N = 1e3 + 100;
ll n, m;
char mp[N][N];
ll vis[N][N]={0};
ll dx[] = {1, 0};
ll dy[] = {0, 1};
string ans = "";
void dfs(ll x, ll y)
{
    if(x==n&&y==m)
    {
        cout << ans << endl;
        ;
        return;
    }

    for(ll i = 0; i < 2; i++)
    {
        ll xx = x + dx[i];
        ll yy = y + dy[i];
        if(xx > n || yy > m || xx < 1 || yy < 1) continue;
        if(mp[xx][yy] == '#') continue;
        if(vis[xx][yy]) continue;
        vis[xx][yy] = 1;
        if(i==0)
            ans += 'S';
        else
            ans += 'D';
        dfs(xx, yy);
        ans.pop_back();
    }
}
void solve()
{

    cin >> n >> m;
    for(ll i=1; i <= n; i++)
    {
        for(ll j = 1; j <= m; j++)
        {
            cin >> mp[i][j];
        }
    }

    dfs(1, 1);

}
int main()
{
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
